package me.leon.plugin


import com.android.build.gradle.BaseExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.internal.extensibility.DefaultConvention
import org.gradle.kotlin.dsl.findByType

/**
 *  如果出现红色警告可以忽略，不会影响项目的编译和运行
 */
class VersionPlugin : Plugin<Project> {
    override fun apply(project: Project) {
        project.extensions.create("antl", Antl::class.java)
        project.extensions.create("debug", Debug::class.java)
        project.extensions.create("versions", Versions::class.java)

        project.configurePlugins()
        project.configureAndroid()
        project.configureRepo()
        project.configureDependence()
        val android =  project.extensions.findByType<BaseExtension>()
        println("result ${android?.javaClass} $android ${(project.extensions as DefaultConvention).plugins}")
    }
}